package com.sitech.ibnms.util;

import com.sitech.context.SpringContext;
import com.sitech.ibnms.util.dao.SysDictDao;
import com.sitech.ibnms.util.domain.SysDict;
import java.util.Map;

/**
 *
 * <p>Title: SysDictUtil.java</p> <p>Description:数据字典操作类</p> <p>Copyright:
 * Copyright (c) SITECH 2011</p>
 *
 * @author LJ, liujhc @date Sep 27, 2011 2:39:19 PM
 * @version V6.0
 */
public class SysDictUtil {

    private SysDictUtil() {
    }

    /**
     * 通过数据字典的CATEGORY_ID获取对应的数据字典对象<br/> SysDict dict =
     * SysDictUtil.getSysDict("100");<br/>
     *
     * @param dictId
     * @param paramsMap sql的动态参数
     * @return
     */
    public static SysDict getSysDict(String dictId, Map paramsMap) {
        return DaoHolder.DAO.getSysDict(dictId, paramsMap);
    }

    /**
     * 通过数据字典的CATEGORY_ID获取对应的数据字典对象<br/> SysDict dict =
     * SysDictUtil.getSysDict("100");<br/>
     *
     * @param dictId
     * @return
     */
    public static SysDict getSysDict(String dictId) {
        return DaoHolder.DAO.getSysDict(dictId);
    }

    private static class DaoHolder {

        /**
         * DAO延迟初始化，并只初始化一次
         */
        private static final SysDictDao DAO = (SysDictDao) SpringContext.getBean("sysDictDao");
    }
}
